home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / MiniGames / BTW / BTWWallPart.as < prev   
Text File  |  2013-04-24  |  2KB  |  75 lines

  1. class MiniGames.BTW.BTWWallPart extends State
  2. {
  3.    static var sSTATE_IDLE = "Idle";
  4.    static var sSTATE_CRACKED = "Cracked";
  5.    static var sSTATE_BROKEN = "Broken";
  6.    static var sSTATE_DESTROYED = "Destroyed";
  7.    static var nNB_CRACK_SOUNDS = 2;
  8.    static var nCRACK_VOLUME = 30;
  9.    function BTWWallPart(_mcRef, _oParent)
  10.    {
  11.       super(_mcRef);
  12.       this.setState(MiniGames.BTW.BTWWallPart.sSTATE_IDLE);
  13.       this.oParent = _oParent;
  14.       this.mcRef.onRelease = Delegate.create(this.oParent,this.oParent.clickOnWall,this);
  15.    }
  16.    function cleanUp()
  17.    {
  18.       delete this.mcRef.onRelease;
  19.       this.mcRef.onRelease = null;
  20.    }
  21.    function damage()
  22.    {
  23.       var _loc2_ = this.sState;
  24.       switch(this.sState)
  25.       {
  26.          case MiniGames.BTW.BTWWallPart.sSTATE_IDLE:
  27.             this.setState(MiniGames.BTW.BTWWallPart.sSTATE_CRACKED);
  28.             this.playCrackSound();
  29.             break;
  30.          case MiniGames.BTW.BTWWallPart.sSTATE_CRACKED:
  31.             this.setState(MiniGames.BTW.BTWWallPart.sSTATE_BROKEN);
  32.             this.playCrackSound();
  33.             break;
  34.          case MiniGames.BTW.BTWWallPart.sSTATE_BROKEN:
  35.             this.setState(MiniGames.BTW.BTWWallPart.sSTATE_DESTROYED);
  36.             this.playCrackSound();
  37.             break;
  38.          case MiniGames.BTW.BTWWallPart.sSTATE_DESTROYED:
  39.       }
  40.       if(_loc2_ != MiniGames.BTW.BTWWallPart.sSTATE_DESTROYED)
  41.       {
  42.          this.mcRef.mcRocks.gotoAndPlay(1);
  43.          for(var i in this.mcRef.mcRocks)
  44.          {
  45.             this.mcRef.mcRocks[i].gotoAndPlay(1);
  46.          }
  47.       }
  48.    }
  49.    function isDestroyed()
  50.    {
  51.       var _loc2_ = false;
  52.       if(this.sState == MiniGames.BTW.BTWWallPart.sSTATE_DESTROYED)
  53.       {
  54.          _loc2_ = true;
  55.       }
  56.       return _loc2_;
  57.    }
  58.    function playCrackSound()
  59.    {
  60.       Controller.getRef().getSounds().playRandomSound(MiniGames.BTW.BTWWallPart.nNB_CRACK_SOUNDS,"Wall_Cracked",MiniGames.BTW.BTWWallPart.nCRACK_VOLUME);
  61.    }
  62.    function Idle()
  63.    {
  64.    }
  65.    function Cracked()
  66.    {
  67.    }
  68.    function Broken()
  69.    {
  70.    }
  71.    function Destroyed()
  72.    {
  73.    }
  74. }
  75.